// 任务信息查询参数
export interface JobInfoQueryDTO {
  pageSize?: number
  pageNum?: number
  lastTableSourceId?: number
  triggerStatus?: number
  groupJobNames?: string[]
  startTime?: string
  start?: number
}

// 任务信息VO
export interface JobInfoVO {
  id: number
  groupName: string
  jobName: string
  jobDesc: string
  cronExpression: string
  scheduleType: number
  scheduleTypeDesc: string
  shardingParams: string
  sharding: number
  misfireStrategy: number
  routeStrategy: number
  blockStrategy: number
  retryCount: number
  timeout: number
  triggerStatus: number
  triggerStatusDesc: string
  alarmEmail: string
  nextTriggerTime: string
  lastTriggerTime: string
  createTime: string
  updateTime: string
}

// 任务日志查询参数
export interface JobLogQueryDTO {
  pageSize?: number
  pageNum?: number
  lastTableSourceId?: number
  jobId?: number
  handleCode?: number
  triggerCode?: number
  startTime?: string
  endTime?: string
  executorAddress?: string
  start?: number
}

// 任务日志VO
export interface JobLogVO {
  id: number
  jobId: number
  jobName: string
  groupName: string
  flowId: number
  nextJobLogId: number
  triggerTime: string
  triggerCode: number
  triggerCodeDesc: string
  triggerMsg: string
  startTime: string
  endTime: string
  handleCode: number
  handleCodeDesc: string
  handleMsg: string
  executorAddress: string
  executorHandler: string
  executorParam: string
  executorShardingIndex: number
  executorShardingParam: string
  executorFailRetryCount: number
  alarmStatus: number
  timeCost: number
  createTime: string
  updateTime: string
}

// 分页结果
export interface PageResult<T> {
  records: T[]
  total: number
  current: number
  size: number
  pages: number
}

// API响应结果
export interface ApiResult<T> {
  code: number
  message: string
  data: T
  timestamp: number
  success: boolean
}

// 线程池监控查询参数
export interface ThreadPoolMonitorQueryDTO {
  pageSize?: number
  pageNum?: number
  lastTableSourceId?: number
  registerKey?: string
  appName?: string
  startTime?: string
  endTime?: string
  statType?: string
  start?: number
}

// 线程池监控数据
export interface ThreadPoolMonitorPO {
  id: number
  createTime: string
  updateTime: string
  creator: string
  updater: string
  deleted: number
  registerKey: string
  appName: string
  monitorTime: string
  timestamp: number
  corePoolSize: number
  maximumPoolSize: number
  poolSize: number
  activeCount: number
  queueSize: number
  queueRemainingCapacity: number
  completedTaskCount: number
  taskCount: number
  maxMemoryMb: number
  totalMemoryMb: number
  usedMemoryMb: number
  freeMemoryMb: number
  memoryUsagePercent: number
  runningTaskCount: number
  delayTaskCount: number
  completedTasksLastMinute: number
  failedTasksLastMinute: number
  averageTaskExecutionTimeMs: number
  threadStackInfo: string
}

// 执行器统计查询参数
export interface ExecutorStatisticsQueryDTO {
  queryDate?: string
  appName?: string
  registerKey?: string
  includeTaskStatistics?: boolean
  includeMemoryStatistics?: boolean
}

// 应用统计VO
export interface AppStatisticsVO {
  appName: string
  executorCount: number
  totalTasks: number
  completedTasks: number
  failedTasks: number
  averageMemoryUsage: number
  averageActiveThreads: number
}

// 执行器详情VO
export interface ExecutorDetailVO {
  registerKey: string
  appName: string
  monitorTime: string
  status: string
  healthStatus: string
  corePoolSize: number
  maximumPoolSize: number
  poolSize: number
  activeCount: number
  queueSize: number
  queueRemainingCapacity: number
  completedTaskCount: number
  taskCount: number
  runningTaskCount: number
  delayTaskCount: number
  completedTasksLastMinute: number
  failedTasksLastMinute: number
  averageTaskExecutionTimeMs: number
  memoryUsagePercent: number
  usedMemoryMb: number
  maxMemoryMb: number
  lastHeartbeatTime: string
  environmentData: EnvironmentMonitorVO
  environmentHistory: EnvironmentMonitorVO[]
  threadPoolStatistics: ThreadPoolStatisticsVO
}

// 执行器状态统计
export interface ExecutorStatusStatistics {
  normalCount: number
  warningCount: number
  errorCount: number
  offlineCount: number
}

// 小时统计VO
export interface HourlyStatisticsVO {
  hour: number
  executorCount: number
  totalTasks: number
  completedTasks: number
  failedTasks: number
  averageMemoryUsage: number
  averageActiveThreads: number
}

// 总体统计
export interface OverallStatistics {
  totalExecutors: number
  totalApps: number
  onlineExecutors: number
  offlineExecutors: number
  totalTasks: number
  totalActiveThreads: number
  totalRunningTasks: number
  averageMemoryUsage: number
}

// 任务执行统计
export interface TaskExecutionStatistics {
  totalCompletedTasks: number
  totalFailedTasks: number
  totalDelayTasks: number
  averageTaskExecutionTime: number
  taskSuccessRate: number
}

// 执行器统计VO
export interface ExecutorStatisticsVO {
  queryDate: string
  overallStatistics: OverallStatistics
  executorStatusStatistics: ExecutorStatusStatistics
  taskExecutionStatistics: TaskExecutionStatistics
  executorDetails: ExecutorDetailVO[]
  hourlyStatistics: HourlyStatisticsVO[]
  appStatistics: AppStatisticsVO[]
}

// 任务每日执行查询参数
export interface JobDailyExecutionQueryDTO {
  jobId?: number
  queryDate?: string
  triggerCode?: number
  executorAddress?: string
  includeRegistryInfo?: boolean
}

// 执行器注册VO
export interface ExecutorRegistryVO {
  executorAddress: string
  appName: string
  registryTime: string
  lastHeartbeatTime: string
  registryStatus: number
  registryStatusDesc: string
}

// 任务执行详情VO
export interface JobExecutionDetailVO {
  id: number
  triggerTime: string
  startTime: string
  endTime: string
  triggerCode: number
  triggerCodeDesc: string
  triggerResult: number
  triggerResultDesc: string
  executorAddress: string
  executorHandler: string
  executorParam: string
  timeCost: number
  triggerMsg: string
  handleMsg: string
}

// 任务执行器统计VO
export interface JobExecutorStatisticsVO {
  executorAddress: string
  executionCount: number
  successCount: number
  failureCount: number
  averageExecutionTime: number
  registryInfo?: ExecutorRegistryVO
}

// 任务小时统计VO
export interface JobHourlyStatisticsVO {
  hour: number
  executionCount: number
  successCount: number
  failureCount: number
  averageExecutionTime: number
}

// 任务每日执行VO
export interface JobDailyExecutionVO {
  jobId: number
  jobName: string
  groupName: string
  queryDate: string
  totalExecutions: number
  successCount: number
  failureCount: number
  runningCount: number
  averageExecutionTime: number
  maxExecutionTime: number
  minExecutionTime: number
  executionDetails: JobExecutionDetailVO[]
  executorStatistics: JobExecutorStatisticsVO[]
  hourlyStatistics: JobHourlyStatisticsVO[]
}

// 执行器运行情况相关类型
export interface ExecutorRuntimeQueryDTO {
  registerKey?: string
  appName?: string
  startTime?: string
  endTime?: string
  status?: string
  pageNum?: number
  pageSize?: number
}

export interface ExecutorRuntimeVO {
  registerKey: string
  appName: string
  lastHeartbeatTime: string
  lastMonitorTime: string
  status: string
  statusDesc: string
  currentPoolSize: number
  currentActiveCount: number
  currentQueueSize: number
  currentMemoryUsagePercent: number
  currentRunningTasks: number
  uptimeSeconds: number
  isOnline: boolean
  healthStatus: string
  healthStatusDesc: string
}

// 执行器运行时详情VO
export interface ExecutorRuntimeDetailVO {
  registerKey: string
  appName: string
  lastHeartbeatTime: string
  lastMonitorTime: string
  status: string
  statusDesc: string
  currentPoolSize: number
  maximumPoolSize: number
  currentActiveCount: number
  currentQueueSize: number
  currentMemoryUsagePercent: number
  currentRunningTasks: number
  uptimeSeconds: number
  isOnline: boolean
  healthStatus: string
  healthStatusDesc: string
}

// 线程池统计VO
export interface ThreadPoolStatisticsVO {
  queryDate: string
  overallStatistics: OverallStatistics
  executorStatusStatistics: ExecutorStatusStatistics
  taskExecutionStatistics: TaskExecutionStatistics
  executorDetails: ExecutorDetailVO[]
  hourlyStatistics: HourlyStatisticsVO[]
  appStatistics: AppStatisticsVO[]
}

export interface ExecutorRuntimeOverviewVO {
  totalExecutors: number
  onlineExecutors: number
  offlineExecutors: number
  healthyExecutors: number
  warningExecutors: number
  errorExecutors: number
  totalActiveThreads: number
  totalRunningTasks: number
  averageMemoryUsage: number
  averageQueueUsage: number
  statusDistribution: ExecutorStatusStatistics[]
  appDistribution: AppStatisticsVO[]
  recentActiveExecutors: ExecutorRuntimeVO[]
}

// 环境监控相关类型
export interface EnvironmentMonitorQueryDTO {
  pageNum?: number
  pageSize?: number
  registerKey?: string
  appName?: string
  startTime?: string
  endTime?: string
  minCpuUsage?: number
  maxCpuUsage?: number
  minMemoryUsage?: number
  maxMemoryUsage?: number
  minHeapMemoryUsage?: number
  maxHeapMemoryUsage?: number
}

// 环境监控历史数据查询DTO
export interface EnvironmentMonitorHistoryQueryDTO {
  registerKey: string
  startTime?: string
  endTime?: string
  limit?: number
}

export interface EnvironmentMonitorVO {
  id: number
  registerKey: string
  appName: string
  monitorTime: string
  osName: string
  osVersion: string
  osArch: string
  cpuCores: number
  cpuUsagePercent: number
  totalMemoryMB: number
  usedMemoryMB: number
  freeMemoryMB: number
  systemMemoryUsagePercent: number
  systemLoadAverage: number
  uptimeSeconds: number
  jvmVersion: string
  jvmVendor: string
  jvmName: string
  jvmStartTime: number
  jvmUptime: number
  maxHeapMemoryMB: number
  usedHeapMemoryMB: number
  freeHeapMemoryMB: number
  heapMemoryUsagePercent: number
  maxNonHeapMemoryMB: number
  usedNonHeapMemoryMB: number
  nonHeapMemoryUsagePercent: number
  threadCount: number
  daemonThreadCount: number
  peakThreadCount: number
  classLoaderCount: number
  loadedClassCount: number
  totalLoadedClassCount: number
  unloadedClassCount: number
  diskInfosJson: string
  networkInfoJson: string
  gcInfosJson: string
  processId: number
  processName: string
  processCpuUsagePercent: number
  processMemoryUsageMB: number
  processThreadCount: number
  openFileCount: number
  processPriority: number
  createTime: string
  updateTime: string
}

export interface EnvironmentMonitorStatisticsVO {
  totalExecutors: number
  onlineExecutors: number
  offlineExecutors: number
  averageCpuUsage: number
  averageSystemMemoryUsage: number
  averageHeapMemoryUsage: number
  averageThreadCount: number
  maxCpuUsage: number
  maxSystemMemoryUsage: number
  maxHeapMemoryUsage: number
  maxThreadCount: number
  minCpuUsage: number
  minSystemMemoryUsage: number
  minHeapMemoryUsage: number
  minThreadCount: number
  executorStatistics: ExecutorStatistics[]
}

export interface ExecutorStatistics {
  registerKey: string
  appName: string
  averageCpuUsage: number
  averageSystemMemoryUsage: number
  averageHeapMemoryUsage: number
  averageThreadCount: number
  maxCpuUsage: number
  maxSystemMemoryUsage: number
  maxHeapMemoryUsage: number
  maxThreadCount: number
  dataCount: number
  lastMonitorTime: string
}

// 仪表盘相关类型定义
export interface DashboardOverviewVO {
  executorRuntime: ExecutorRuntimeOverviewVO
  threadPoolOverview: ThreadPoolOverviewVO
  environmentOverview: EnvironmentOverviewVO
  overallStats: OverallStatisticsVO
}

export interface ThreadPoolOverviewVO {
  totalExecutors: number
  totalApps: number
  totalActiveThreads: number
  totalRunningTasks: number
  avgMemoryUsage: number
  dataPoints: number
}

export interface EnvironmentOverviewVO {
  totalExecutors: number
  avgCpuUsage: number
  avgMemoryUsage: number
  avgHeapMemoryUsage: number
}

export interface OverallStatisticsVO {
  totalExecutors: number
  onlineExecutors: number
  offlineExecutors: number
  healthyExecutors: number
  warningExecutors: number
  errorExecutors: number
  totalActiveThreads: number
  totalRunningTasks: number
  averageMemoryUsage: number
  healthRate: number
  onlineRate: number
}

export interface ExecutorListItemVO {
  registerKey: string
  appName: string
  status: string
  healthStatus: string
}

export interface ExecutorTrendVO {
  threadPoolTrend: ThreadPoolMonitorPO[]
  environmentTrend: EnvironmentMonitorVO[]
}

// 在线执行器趋势数据
export interface OnlineExecutorsTrendVO {
  trendData: OnlineExecutorsTrendData[]
}

export interface OnlineExecutorsTrendData {
  hour: number
  onlineCount: number
  offlineCount: number
  totalCount: number
  onlineRate: number
  timePoint: string
}

// 任务触发器状态相关类型
export interface JobTriggerStatusVO {
  running: boolean
  statusDescription: string
  startTime: string
  lastUpdateTime: string
} 